/*ControladorBuscarLogin
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package web;

import Persistencia.*;
import controladores.ControladorFisioterapeuta;
import dominio.login;
import org.springframework.web.servlet.mvc.Controller;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import java.io.IOException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 *
 * @author Alith
 */
public class ControladorBuscarLogin implements Controller{

    ControladorFisioterapeuta controlador;
    Fisioterapeuta obj;

    @Override
    public ModelAndView handleRequest(HttpServletRequest hsr, HttpServletResponse hsr1) throws Exception {
        controlador = new ControladorFisioterapeuta();
        System.out.println("ControladorBuscarLogin");
        if(hsr.getParameter("id") != null){
            controlador = new ControladorFisioterapeuta();
            String id = hsr.getParameter("id");
            Login login = controlador.buscarLoginFisioterapeuta(id);
            if(login!=null){
                return new ModelAndView("modificarLogin", "model", login);
            }
            return new ModelAndView("administrarFisioterapeutas", "model", controlador.encontrarFisioterapeutas());
        }else{
            return new ModelAndView("administrarFisioterapeutas", "model", controlador.encontrarFisioterapeutas());
        }
    }

    public void setControladorFisioterapeuta(ControladorFisioterapeuta productManager) {
        this.controlador = productManager;
    }

    public ControladorFisioterapeuta getControladorFisioterapeuta() {
        return controlador;
    }
}

